package edu.cmu.cs.erl.pltests;

import java.util.List;

import org.junit.Test;

import jp.ac.kobe_u.cs.prolog.lang.JavaObjectTerm;
import jp.ac.kobe_u.cs.prolog.lang.Predicate;
import jp.ac.kobe_u.cs.prolog.lang.PrologControl;
import jp.ac.kobe_u.cs.prolog.lang.Term;
import jp.ac.kobe_u.cs.prolog.lang.VariableTerm;
import edu.cmu.cs.erl.ERLError;
import edu.cmu.cs.erl.ERLException;
import edu.cmu.cs.erl.rules.PRED_returnTest_2;


/**
 * Pass in and out an object.
 * 
 * @author cchristo
 *
 */
public class SimpleTest {
	@Test
	public void simple() {
		PrologControl control = new PrologControl();
		Predicate pred = new PRED_returnTest_2();
				
		VariableTerm returnValue = new VariableTerm();
		Term[] args = new Term[]{new JavaObjectTerm("w00t!"), returnValue};

		if (control.execute(pred, args)) {
			JavaObjectTerm object = (JavaObjectTerm)returnValue.dereference();
			System.out.println("Got back a " + object.object().toString());
		}
		else
			System.out.println("Failed");

	}
}
